﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Noea.TogSim.Model.Interfaces
{
    /// <summary>
    /// To be implemented by LocoDrivers. 
    /// An AI locodriver should react on events in the model, i.e a signal
    /// A human locodriver implementation should react on event in an user interface, such as breaking.
    /// </summary>
    public interface ILocoDriver
    {
        /// <summary>
        /// Set, gets current acceleration. May be used by a human locodriver, or AI state machine 
        /// </summary>
        double Acceleration { get; set; }
        /// <summary>
        /// Set, gets current deacceleration. May be used by a human locodriver, or AI state machine 
        /// </summary>
        double Deacceleration { get; set; }
        /// <summary>
        /// Gets the train set associated with the LocoDriver
        /// </summary>
        ITrainSet Train { get; }
        /// <summary>
        /// Gets a description string for the current state of the train set, i.e 'Running' og 'Wait for signal'
        /// </summary>
        string StateDescription { get; }
        /// <summary>
        /// Request a state update. This method should be called by a scheduling mechanism.
        /// </summary>
        /// <param name="obj">Object that can be used to pass stateinformation. I.e to used by a timer delegate</param>
        void UpdateState(Object obj);
        /// <summary>
        /// Returns suggested update interval for the state machine
        /// </summary>
        long Interval { get; }
        /// <summary>
        /// Event handler for change of current track. Used by AI locodriver to react on signals
        /// </summary>
        /// <param name="train">Actual train set</param>
        /// <param name="args">EventArg with further information</param>
        void Go();
        /// <summary>
        /// Set the locodriver into stopped state.
        /// </summary>
        void Stop();
    }
}
